var e = require("../../../mycomponent/yz_pay/yz_pay"), t = getApp();

Page({
    behaviors: [ e ],
    data: {
        language: "",
        isclick: !0,
        order_id: "",
        store_id: "",
        orderData: null,
        balance: 0,
        payParams: "",
        info_form: {},
        order_sn: "",
        buttons: [],
        pay_sn: "订单编号",
        order_pay_id: "",
        uid: "",
        pid: "",
        status: "",
        money: "",
        circleID: 0
    },
    onLoad: function(e) {
        var a = this;
        console.log("options:", e), e.circleId && 0 != e.circleId && (this.data.circleId = e.circleId), 
        e.money && 0 != e.money && this.setData({
            money: e.money
        });
        var n = t.getNetAddresss("plugin.circle.frontend.circle-pay.get-pay-button");
        t._getNetWork({
            url: n,
            success: function(e) {
                var t = e.data.data;
                console.log("PayResult::::", t), 1 == e.data.result ? (a.hanleIcon(t), a.setData({
                    buttons: t.buttons
                })) : (wx.showToast({
                    title: e.data.msg,
                    icon: "success",
                    duration: 2e3
                }), console.log("错误", e.data.msg));
            },
            fail: function(e) {
                console.log("===============", e);
            }
        });
    },
    fromChild: function(e) {
        if ("0.00" == this.data.money) this.sureBtn(); else {
            var t = e.detail.submitArr;
            this.confirm(t);
        }
    },
    onReady: function() {
        var e = wx.getStorageSync("langIndex");
        this.setData({
            language: e.en
        });
    },
    confirm: function(e) {
        var t = e;
        this.surePay(t);
    },
    surePay: function(e) {
        var a = this, n = {
            pay_method: e.value,
            pay_name: e.name,
            circle_id: this.data.circleId
        }, o = t.getNetAddresss("plugin.circle.frontend.circle-pay.index");
        t._getNetWork({
            url: o,
            data: n,
            success: function(t) {
                var n = t.data;
                1 == n.result ? a.handleOtherPay(e, e.value, n.data, "circle") : wx.showToast({
                    title: n.msg,
                    icon: "none",
                    duration: 2e3,
                    success: function() {}
                });
            },
            fail: function(e) {
                console.log(e, "错误");
            }
        });
    }
});